import Vue from 'vue'
import { createSSRApp } from 'vue'
import uView from '@/uni_modules/uview-ui'
import App from './App'
import * as filters from '@/utils/filters.js' // 过滤器
import store from '@/store/index'
Vue.use(uView)
// 分享
import shareMixin from '@/mixins/shareMixin.js'
Vue.mixin(shareMixin)
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

import { baseUrl } from '@/static/js/staticData' // 全局常量文件（基础地址）
uni.$baseUrl = baseUrl
Vue.prototype.$baseUrl = baseUrl

uni.$showMsg = function (
  title = '数据请求失败！',
  duration = 1500,
  mask = false
) {
  uni.showToast({
    title,
    duration,
    mask,
    icon: 'none',
  })
}
// uni-app生产环境去掉console
// if (uni.getSystemInfoSync().platform !== 'devtools') {
//   console.log = () => { }
// }
// #ifndef VUE3
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  ...App,
  store,
})
app.$mount()
// #endif
// #ifdef VUE3
export function createApp() {
  const app = createSSRApp(App)
  return {
    app,
  }
}
// #endif
